import { request } from "@umijs/max";
/**
 * 获取Topic列表
 * @param params
 * @returns
 */
export function get_topic_list(
  params: Types.Topic.ITopicSearch
): Promise<Types.Http.Response<Types.Topic.ITopicList>> {
  return request("/api/v1/admin/topic/list", { params });
}

/**
 * 新增Topic
 * @param data
 * @returns
 */
export function add_topic(data: Types.Topic.ITopicInfo): Promise<Types.Http.Response<null>> {
  return request("/api/v1/admin/topic/create", { data, method: "post" });
}

/**
 * 获取Topic详情
 * @param params
 * @returns
 */
export function get_topic_detail(id: string): Promise<Types.Http.Response<Types.Topic.ITopicInfo>> {
  return request("/api/v1/admin/topic/detail/" + id);
}

/**
 * 编辑 Topic
 * @param data
 * @returns
 */
export function edit_topic(data: Types.Topic.ITopicInfo): Promise<Types.Http.Response<null>> {
  return request("/api/v1/admin/topic/edit", { data, method: "post" });
}

/**
 * 删除 Topic
 * @param data
 * @returns
 */
export function delete_topic(id: string): Promise<Types.Http.Response<null>> {
  return request("/api/v1/admin/topic/delete/" + id);
}
